use chrono::{DateTime, Duration, Local};
use crate::hystrix::metriccollector::MetricResult;

struct CommandExecution {
    types:Vec<String>,
    start:DateTime<Local>,
    run_duration:Duration,
    concurrency_in_use:f64,
}

impl Default for CommandExecution {
    fn default() -> Self {
        CommandExecution{
            types: vec![],
            start: Local::now(),
            run_duration: Duration::seconds(0),
            concurrency_in_use: 0.0
        }
    }
}

pub trait MetricCollector {
    fn update(&mut self,data:MetricResult);
    fn reset(&mut self);
}

pub struct MetricsExchange<T> where T:MetricCollector {
    name:String,
    metric_collectors:Vec<T>,
}

impl<T> MetricsExchange<T> where T:MetricCollector {
    pub fn new(name:String) -> Self {
        let mut m = MetricsExchange{
            name,
            metric_collectors: vec![]
        };
        

        m
    }
}
